import {Component, ViewEncapsulation} from '@angular/core';
import { Router } from '@angular/router';

@Component({
  selector: 'pages',
  encapsulation: ViewEncapsulation.None,
  styles: [],
  template: `
    <ba-sidebar></ba-sidebar>
    <ba-page-top></ba-page-top>
    <div class="al-main">
      <div class="al-content">
        <ba-content-top></ba-content-top>
        <router-outlet></router-outlet>
      </div>
    </div>
    <ba-back-top position="200"></ba-back-top>
    `
})
export class Pages {
  constructor(private router: Router) {
  }

  ngOnInit() {
    let user = localStorage.getItem('accessToken');
    if (user) {
      console.log(' user name' + user);
      this.router.navigateByUrl('pages');
    } else {
      console.log(' not login,redirect to login');
      // this.router.navigateByUrl('login');
    }
  }
}
